Recursive queries using common table expressions >使用公用表表達(dá)式的遞歸查詢
Create a recursive query 創(chuàng)建遞歸查詢。
In sql server 2005 , a query is referred to as a recursive query when it references a recursive cte 在sql server 2005中,當(dāng)某個(gè)查詢引用遞歸cte時(shí),它即被稱為“遞歸查詢” 。
Using a cte allows the use of recursive queries and can simplify logic by replacing the use of temporary tables or views 利用cte ,可使用遞歸查詢并可通過(guò)取代臨時(shí)表或視圖來(lái)簡(jiǎn)化邏輯。
The transact - sql language has been extended with features such as improved error handling and support for recursive queries Transact - sql語(yǔ)言得到了擴(kuò)展,例如,改進(jìn)了錯(cuò)誤處理功能,支持遞歸查詢。
Uses a recursive query common table expression to return the direct and indirect employees of the specified manager Dbo . uspgetmanageremployees使用遞歸查詢(公用表表達(dá)式)來(lái)返回指定經(jīng)理的直接和間接下屬。
Uses a recursive query common table expression to return the direct and indirect managers of the specified employee Dbo . uspgetemployeemanagers使用遞歸查詢(公用表表達(dá)式)來(lái)返回指定雇員的直接和間接上司。
Uses a recursive query common table expression to return all product assemblies that use the specified product component Dbo . uspgetwhereusedproductid使用遞歸查詢(公用表表達(dá)式)來(lái)返回使用指定產(chǎn)品組件的所有產(chǎn)品部件。
In earlier versions of sql server , a recursive query usually requires using temporary tables , cursors , and logic to control the flow of the recursive steps 在sql server的早期版本中,遞歸查詢通常需要使用臨時(shí)表、游標(biāo)和邏輯來(lái)控制遞歸步驟流。
A recursive cte can greatly simplify the code required to run a recursive query within a select , insert , update , delete , or create view statement 遞歸cte可以極大地簡(jiǎn)化在select 、 insert 、 update 、 delete或create view語(yǔ)句中運(yùn)行遞歸查詢所需的代碼。